Skip to content

fix(storage): apply metadata, headers, and cacheControl dedupe to uploadToSignedUrl - #2275

Merged
mandarini merged 1 commit into
supabase:masterfrom
oniani1:fix/upload-signed-url-parity
Apr 24, 2026
Merged

mandarini merged 1 commit into
supabase:masterfrom
oniani1:fix/upload-signed-url-parity

Conversation

@oniani1

@oniani1 oniani1 commented Apr 23, 2026 •

Copy link
Copy Markdown
Contributor

Closes #2274.

Summary

uploadToSignedUrl silently drops three FileOptions that upload/update honor via uploadOrUpdate:

  1. options.metadata is ignored. No form field on Blob/FormData bodies, no x-metadata header on raw bodies.
  2. fileOptions.headers is ignored. The setHeader merge loop was missing.
  3. cacheControl on caller-supplied FormData got appended unconditionally, producing two entries when the caller already added one.

This patch mirrors the handling from uploadOrUpdate across all three body branches (Blob, FormData, raw) and adds the post-branch headers merge. No behavioral change for the content-type / cache-control defaults on raw bodies, nor for the fallbacks when the options are absent.

Test plan

  • uploadToSignedUrl with metadata (Blob body). FormData includes a metadata field.
  • uploadToSignedUrl with metadata (FormData body). Caller's FormData keeps its own entries and gains metadata.
  • uploadToSignedUrl with metadata (raw body sends x-metadata header). Base64-encoded JSON in the x-metadata request header.
  • uploadToSignedUrl passes headers. fileOptions.headers keys reach the outgoing request.
  • uploadToSignedUrl does not duplicate cacheControl when caller FormData has one. Caller's 7200 wins, SDK's 3600 default is skipped.

All 10 uploadToSignedUrl tests pass, including the 5 new ones. The fix was also reproduced end-to-end against a local supabase/storage Docker server.

…oadToSignedUrl

uploadToSignedUrl was silently dropping three FileOptions that upload/update
honor: metadata (no form field or x-metadata header), fileOptions.headers
(loop never ran), and de-duping a caller-provided cacheControl field on
FormData bodies (appended unconditionally).

Mirrors the equivalent handling in uploadOrUpdate across all three body
branches (Blob, FormData, raw) and the post-branch fileOptions.headers merge.

Tests added alongside the existing uploadToSignedUrl body payload tests.
@oniani1
oniani1 requested review from a team as code owners April 23, 2026 19:23
@pkg-pr-new

pkg-pr-new Bot commented Apr 23, 2026

Copy link
Copy Markdown

Open in StackBlitz

@supabase/auth-js

npm i https://pkg.pr.new/@supabase/auth-js@2275

@supabase/functions-js

npm i https://pkg.pr.new/@supabase/functions-js@2275

@supabase/postgrest-js

npm i https://pkg.pr.new/@supabase/postgrest-js@2275

@supabase/realtime-js

npm i https://pkg.pr.new/@supabase/realtime-js@2275

@supabase/storage-js

npm i https://pkg.pr.new/@supabase/storage-js@2275

@supabase/supabase-js

npm i https://pkg.pr.new/@supabase/supabase-js@2275

commit: 7085a5b

@mandarini
mandarini merged commit 16238e8 into supabase:master Apr 24, 2026
22 checks passed
mandarini pushed a commit to supabase/ssr that referenced this pull request Apr 27, 2026
This PR updates `@supabase/supabase-js` to v2.105.0.

**Source**: supabase-js-stable-release

---

## Release Notes

## v2.105.0

## 2.105.0 (2026-04-27)

### 🚀 Features

- **auth:** add passkey support with WebAuthn registration,
authentication, and management
([#2283](supabase/supabase-js#2283))
- **realtime:** Realtime deferred disconnect
([#2282](supabase/supabase-js#2282))

### 🩹 Fixes

- **postgrest:** narrow column types after not(column, is, null)
([#2264](supabase/supabase-js#2264))
- **realtime:** annotate Timer/Vsn getters to avoid deep phoenix imports
([#2284](supabase/supabase-js#2284))
- **storage:** apply metadata, headers, and cacheControl dedupe to
uploadToSignedUrl
([#2275](supabase/supabase-js#2275))
- **storage:** forward duplex option for stream uploads via
uploadToSignedUrl
([#2289](supabase/supabase-js#2289))

### ❤️ Thank You

- Katerina Skroumpelou @mandarini
- oniani1

This PR was created automatically.

Co-authored-by: supabase-workflow-trigger[bot] <266661614+supabase-workflow-trigger[bot]@users.noreply.github.com>
mandarini pushed a commit to supabase/supabase that referenced this pull request May 6, 2026
This PR updates @supabase/*-js libraries to version 2.105.3.

**Source**: supabase-js-stable-release

**Changes**:
- Updated @supabase/supabase-js to 2.105.3
- Updated @supabase/auth-js to 2.105.3
- Updated @supabase/realtime-js to 2.105.3
- Updated @supabase/postgest-js to 2.105.3
- Refreshed pnpm-lock.yaml

---

## Release Notes

## v2.105.3

## 2.105.3 (2026-05-04)

### 🩹 Fixes

- **auth:** narrow OAuth/CustomProvider types to fix downstream consumer
typecheck ([#2326](supabase/supabase-js#2326))
## v2.105.2

## 2.105.2 (2026-05-04)

### 🩹 Fixes

- **auth:** forward lockAcquireTimeout to SupabaseAuthClient
([#2309](supabase/supabase-js#2309))
- **auth:** add toJSON to WebAuthnError for correct JSON serialization
([#2317](supabase/supabase-js#2317))
- **misc:** widen enum-like unions with (string & {}) for forward compat
([#2303](supabase/supabase-js#2303))
- **misc:** reduce any usage across packages
([#2314](supabase/supabase-js#2314))
- **postgrest:** unify insert/upsert signatures
([#2315](supabase/supabase-js#2315))

### ❤️ Thank You

- Muzzaiyyan Hussain @MuzzaiyyanHussain
## v2.105.1

## 2.105.1 (2026-04-28)

### 🩹 Fixes

- **postgrest:** query reassignment regression
([#2292](supabase/supabase-js#2292))
- **realtime:** surface real Error on transport-level CHANNEL_ERROR
([#2299](supabase/supabase-js#2299))

### ❤️ Thank You

- Vaibhav @7ttp
## v2.105.0

## 2.105.0 (2026-04-27)

### 🚀 Features

- **auth:** add passkey support with WebAuthn registration,
authentication, and management
([#2283](supabase/supabase-js#2283))
- **realtime:** Realtime deferred disconnect
([#2282](supabase/supabase-js#2282))

### 🩹 Fixes

- **postgrest:** narrow column types after not(column, is, null)
([#2264](supabase/supabase-js#2264))
- **realtime:** annotate Timer/Vsn getters to avoid deep phoenix imports
([#2284](supabase/supabase-js#2284))
- **storage:** apply metadata, headers, and cacheControl dedupe to
uploadToSignedUrl
([#2275](supabase/supabase-js#2275))
- **storage:** forward duplex option for stream uploads via
uploadToSignedUrl
([#2289](supabase/supabase-js#2289))

### ❤️ Thank You

- Katerina Skroumpelou @mandarini
- oniani1

This PR was created automatically.

Co-authored-by: supabase-workflow-trigger[bot] <266661614+supabase-workflow-trigger[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants